Add introspection friendly version of gtk_tree_path_new_from_indices
authorSimon Feltman <sfeltman@src.gnome.org>
Fri, 16 Aug 2013 10:59:30 +0000 (03:59 -0700)
committerSimon Feltman <sfeltman@src.gnome.org>
Sun, 5 Jan 2014 19:23:41 +0000 (11:23 -0800)
Add gtk_tree_path_new_from_indicesv which takes an array of
integers with a length. Use "Rename to" annotation to rename the
method as gtk_tree_path_new_from_indices. This is needed because
the original method takes variadic arguments which is not supported
by introspection.

https://bugzilla.gnome.org/show_bug.cgi?id=706119

docs/reference/gtk/gtk3-sections.txt
gtk/gtktreemodel.c
gtk/gtktreemodel.h

index aaa9c8e63027c4b76b24b304978dd8cd0e6ecf71..d4fe0cb82cae538556eaeca081bb6a29dae98618 100644 (file)
@@ -4244,6 +4244,7 @@ GtkTreeModelFlags
 gtk_tree_path_new
 gtk_tree_path_new_from_string
 gtk_tree_path_new_from_indices
+gtk_tree_path_new_from_indicesv
 gtk_tree_path_to_string
 gtk_tree_path_new_first
 gtk_tree_path_append_index
index 1a8a9fc94a63f6846404243d3f8092f20f5203e8..b5190013dbfb5a1c96cd519d19b21bd1b08b4f1a 100644 (file)
@@ -681,6 +681,34 @@ gtk_tree_path_new_from_indices (gint first_index,
   return path;
 }
 
+/**
+ * gtk_tree_path_new_from_indicesv: (rename-to gtk_tree_path_new_from_indices)
+ * @indices: (array length=length): array of indices
+ * @length: length of @indices array
+ *
+ * Creates a new path with the given @indices array of @length.
+ *
+ * Return value: A newly created #GtkTreePath
+ *
+ * Since: 3.12
+ */
+GtkTreePath *
+gtk_tree_path_new_from_indicesv (gint *indices,
+                                 gsize length)
+{
+  GtkTreePath *path;
+
+  g_return_val_if_fail (indices != NULL && length != 0, NULL);
+
+  path = gtk_tree_path_new ();
+  path->alloc = length;
+  path->depth = length;
+  path->indices = g_new (gint, length);
+  memcpy (path->indices, indices, length * sizeof (gint));
+
+  return path;
+}
+
 /**
  * gtk_tree_path_to_string:
  * @path: A #GtkTreePath
index e1ebde52b88569d3e177ff1ca018c9710f3d49cc..a1cccc2c8a42f7d27303df1c3c263f6f56a91275 100644 (file)
@@ -167,6 +167,9 @@ GtkTreePath *gtk_tree_path_new_from_string  (const gchar       *path);
 GDK_AVAILABLE_IN_ALL
 GtkTreePath *gtk_tree_path_new_from_indices (gint               first_index,
                                             ...);
+GDK_AVAILABLE_IN_3_12
+GtkTreePath *gtk_tree_path_new_from_indicesv (gint             *indices,
+                                             gsize             length);
 GDK_AVAILABLE_IN_ALL
 gchar       *gtk_tree_path_to_string        (GtkTreePath       *path);
 GDK_AVAILABLE_IN_ALL